<div class="block-bar">
    <div class="container">
        <div class="block-body row">
            <div class="common-block" style="margin:0 10px;">
                <div style="margin:0 -10px;">
                    <div class="col-xs-9">
                        <div>
                            <h2>
                                {:modC('Wechat_POST_SHOW_TITLE', L('_POST_HOT_'), 'Wechat')}
                            </h2>

                            <div>
                                <volist name="Wechat_post_list" id="vo">
                                    <php>
                                        $user = query_user(array('avatar128','avatar64','nickname','uid','space_url'),$vo['uid']);
                                    </php>
                                    <div class="clearfix">
                                        <div class="col-xs-2 text-center">
                                            <p>
                                                <a href="{$user.space_url}">
                                                    <img src="{$user.avatar64}" ucard="{$user.uid}" class="avatar-img"/>
                                                </a>
                                            </p>
                                        </div>
                                        <div class="col-xs-10">
                                            <p>
                                                <a class="Wechat_Wechat_name" href="{:U('Wechat/Index/Wechat',array('id'=>$vo['Wechat_id']))}">[{$vo.Wechat.title|text}]</a>
                                                <a class="Wechat-list-title-link" title="{$vo.title|text}"
                                                   href="{:U('Wechat/Index/detail',array('id'=>$vo['id']))}">{$vo.title|htmlspecialchars|mb_substr=0,30,'utf-8'}
                                                </a>
                                                <eq name="document.is_top" value="2"><span class="label label-badge label-danger">{:L('_ALL_SITE_')}</span>
                                                    <else/>
                                                    <eq name="document.is_top" value="1"><span class="label label-badge label-info">{:L('')}</span></eq>
                                                </eq>
                                            </p>

                                            <p class="pull-right text-muted">
                                                <span>{:L('_READ_')}（{$vo.view_count}）</span>
                                                <span style="width: 1em; display: inline-block;">&nbsp;</span>
                                                <span>{:L('_REPLY_')}（{$vo.reply_count}）</span>
                                            </p>

                                            <p class="text-muted author">
                                                <a href="{$user.space_url}" ucard="{$user.uid}">{$user.nickname|op_t}</a>
                                                {:L('_PUBLISH_')}{:L('_COLON_')}{$vo.create_time|friendlyDate} |
                                                {:L('_LAST_REPLY_TIME_')}{:L('_COLON_')}{$vo.last_reply_time|friendlyDate}
                                            </p>
                                        </div>
                                    </div>

                                    <if condition="$i neq count($Wechat_post_list)">
                                        <hr class="Wechat-list-hr"/>
                                        <else/>
                                        <div class="Wechat-list-no-hr"></div>
                                    </if>
                                </volist>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-3">
                        <div>
                            <h2>{:modC('Wechat_SHOW_TITLE', L(''), 'Wechat')}</h2>

                            <div class="clearfix position-Wechats">
                                <volist name="Wechat_show" id="vo">
                                    <div class="clearfix">
                                        <div class="col-xs-4 ">
                                            <a href="{:U('Wechat/Index/Wechat',array('id'=>$vo['id']))}"><img
                                                    src="{$vo.logo|getThumbImageById=128,128}"> </a>
                                        </div>
                                        <div class="col-xs-4 text-ellipsis">
                                            <a class="title" href="{:U('Wechat/Index/Wechat',array('id'=>$vo['id']))}">
                                                {$vo.title|text}
                                            </a>

                                            <div class="text-muted">
                                                {:L('_POST_')}{:L('_COLON_')}{$vo.post_count}
                                            </div>

                                        </div>
                                        <div class="col-xs-4">
                                            <eq name="vo.hasFollowed" value="1">
                                                <a class="follow-simple" data-role="followingSimple"
                                                   onclick="Wechat.following_simple(this)"
                                                   data-id="{$vo.id}"><span>{:L('_MINUS_')} {:L('_FOLLOWED_')}</span> </a>
                                                <else/>
                                                <a class="follow-simple" onclick="Wechat.following_simple(this)" data-role="followingSimple"
                                                   data-id="{$vo.id}"><span>{:L('_PLUS_')} {:L('_FOLLOWERS_')}</span> </a>
                                            </eq>
                                        </div>
                                    </div>
                                </volist>
                            </div>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>

</div>
<style>
    .position-Wechats >div{
        margin-bottom: 15px;
    }
    .position-Wechats .text-muted{
        margin-top: 5px;
    }
    .position-Wechats .follow-simple{
        font-size: 14px;
        color: #4f8ad0;
    }
    .Wechat-list-hr{
        margin-top: 0px;
        margin-bottom: 10px;
    }
    .Wechat-list-no-hr{
        padding: 10px;
    }
</style>
<script>
    $(function () {
        ucard();
    })
    var Wechat = {
        'following_simple': function (obj) {
            var id = $(obj).attr('data-id');
            var $obj = $('[data-role=followingSimple][data-id='+id+']');

            $.post(U('Wechat/index/doFollowing'), {id: id}, function (msg) {
                handleAjax(msg);
                if (msg.status == 1) {
                    if(msg.follow==0){
                        $obj.each(function(){
                            $(this).find('span').text("{:L('_PLUS_')} {:L('_FOLLOWERS_')}");
                        })
                    }else{
                        $obj.each(function(){
                            $(this).find('span').text("{:L('_MINUS_')} {:L('_FOLLOWED_')}");
                        })
                    }
                }
            })
        }
    };
</script>